package com.admin.controllerv1;

import com.admin.service.AdsensitiveService;
import com.apis.sensitive.AdsensitiveControllerApi;
import com.usian.model.admin.dtos.SensitiveDto;
import com.usian.model.admin.pojos.AdSensitive;
import com.usian.model.common.dtos.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RequestMapping("/admin/api/v1/sensitive")
@RestController
@Api(value = "敏感词管理",tags = "channel",description = "敏感词管理Apl")
public class AdsensitiveController implements AdsensitiveControllerApi {

    @Autowired
    private AdsensitiveService adsensitiveService;

    /**
     * 敏感词查询
     * @param adSensitive
     * @return
     */
    @PostMapping("list")
    @Override
    @ApiOperation(value = "敏感词查询",notes = "分页")
    @ApiImplicitParam(name = "adSensitive",type = "SensitiveDto",value = "分页参数")
    public ResponseResult sensitiveqc(@RequestBody SensitiveDto adSensitive) {
        return adsensitiveService.sensitiveqc(adSensitive);
    }

    /**
     * 敏感词添加
     * @param adSensitive
     * @return
     */
    @PostMapping("save")
    @Override
    @ApiOperation(value = "敏感词添加",notes = "添加")
    @ApiImplicitParam(name = "adSensitive",type = "AdSensitive",value = "添加参数")
    public ResponseResult save(@RequestBody AdSensitive adSensitive) {
        return adsensitiveService.saveAdSensitive(adSensitive);
    }


    /**
     * 敏感词修改
     * @param adSensitive
     * @return
     */
    @PostMapping("update")
    @Override
    @ApiOperation(value = "敏感词修改",notes = "修改")
    @ApiImplicitParam(name = "adSensitive",type = "AdSensitive",value = "修改参数")
    public ResponseResult update(@RequestBody AdSensitive adSensitive) {
        return adsensitiveService.update(adSensitive);
    }

    /**
     * 敏感词删除
     * @param id
     * @return
     */
    @DeleteMapping("del/{id}")
    @Override
    @ApiOperation(value = "敏感词删除",notes = "删除")
    @ApiImplicitParam(name = "id",type = "Integer",value = "删除参数")
    public ResponseResult del(@PathVariable Integer id) {
        return adsensitiveService.del(id);
    }
}
